package com.fy.fyspace.model.enums.spaceuser;

public enum SpaceUserStatusEnum {

    /**
     * 正常状态
     */
    NOT_DELETE(0, "NOT_DELETE"),

    /**
     * 禁用状态
     */
    IS_DELETE(1, "IS_DELETE");

    private final int status;
    private final String statusStr;

    SpaceUserStatusEnum(int status, String statusStr) {
        this.status = status;
        this.statusStr = statusStr;
    }

    public int getStatus() {
        return status;
    }

    public String getStatusStr() {
        return statusStr;
    }

    public static SpaceUserStatusEnum fromStatus(int status) {
        for (SpaceUserStatusEnum type : values()) {
            if (type.getStatus() == status) {
                return type;
            }
        }
        throw new IllegalArgumentException("Unknown status: " + status);
    }

    public static SpaceUserStatusEnum fromStatusStr(String statusStr) {
        for (SpaceUserStatusEnum type : values()) {
            if (type.getStatusStr().equalsIgnoreCase(statusStr)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Unknown status: " + statusStr);
    }

    @Override
    public String toString() {
        return "SpaceUserStatusEnum{" +
                "status=" + status +
                ", statusStr='" + statusStr + '\'' +
                '}';
    }
}
